package ua.kratik.seabattle.web;

import java.util.HashMap;
import java.util.concurrent.ConcurrentLinkedQueue;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ua.kratik.seabattle.game.Admiral;

public class ServletListener implements ServletContextListener{
	
	private static Logger logger = LoggerFactory.getLogger(ServletListener.class);

	public void contextInitialized(ServletContextEvent sce){
		sce.getServletContext().setAttribute("loggedAdmirals", new HashMap<String, Admiral>());
		logger.debug("Servlet context attribute 'loggedAdmirals' was created");
		
		sce.getServletContext().setAttribute("waitingAdmirals", new ConcurrentLinkedQueue<Admiral>());
		logger.debug("Servlet context attribute 'waitingAdmirals' was created");
	}

	public void contextDestroyed(ServletContextEvent sce) {
		logger.debug("contextDestroyed method was called");
	}

}
